import { loadingInterface } from '@/store/interface/loading';
export default ({
    namespaced: true,
    state: <loadingInterface>{
        loadingNum: 0
    },
    mutations: {
        CHANGE_LOADING_ADD(start: loadingInterface) {
            start.loadingNum++;
        },
        CHANGE_LOADING_REDUCE(start: loadingInterface) {
            if (start.loadingNum > 0) start.loadingNum--;
        },
        CHANGE_LOADING_RESET(start: loadingInterface) {
            start.loadingNum = 0;
        }
    },
    actions: {
        //@ts-ignore
        CHANGE_LOADING_ADD_ACTION({ commit }) {
            commit('CHANGE_LOADING_ADD')//增加
        },
        //@ts-ignore
        CHANGE_LOADING_REDUCE_ACTION({ commit }) {
            commit('CHANGE_LOADING_REDUCE')//减少
        },
        //@ts-ignore
        CHANGE_LOADING_RESET_ACTION({ commit }) {
            commit('CHANGE_LOADING_RESET')//重置
        },
    }
})